// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

@use "common/refactor/common-refactor.scss" as *;

.dashboard-templates-section {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  bottom: 0;
  width: 100%;
  height: $s-228;
  transition: bottom 300ms;
  pointer-events: none;
  &.collapsed {
    bottom: calc(-1 * $s-228);
    transition: bottom 300ms;
  }
}

.title {
  pointer-events: all;
  width: fit-content;
  top: calc(-1 * $s-56);
  text-align: right;
  height: $s-56;
  position: absolute;
  right: calc(-1 * $s-24);
}

.title-btn {
  border: none;
  cursor: pointer;
  height: $s-56;
  display: inline-flex;
  align-items: center;
  border-top-left-radius: $br-10;
  border-top-right-radius: $br-10;
  margin-right: $s-32;
  position: relative;
  z-index: $z-index-1;
  background-color: var(--color-background-quaternary);
}

.title-text {
  display: inline-block;
  vertical-align: middle;
  line-height: 1.2;
  font-size: $fs-16;
  margin-left: $s-16;
  margin-right: $s-8;
  color: var(--color-foreground-primary);
  font-weight: $fw400;
}

.title-icon {
  display: inline-block;
  vertical-align: middle;
  margin-left: $s-16;
  margin-right: $s-8;
  color: var(--color-foreground-primary);
  margin-left: $s-16;
  margin-right: $s-16;
  transform: rotate(90deg);
}

.title-icon-collapsed {
  transform: rotate(-90deg);
}

.arrow-icon {
  @extend .button-icon;
  stroke: var(--icon-foreground);
}

.move-button {
  position: absolute;
  top: $s-136;
  border: $s-2 solid var(--color-foreground-secondary);
  border-radius: 50%;
  text-align: center;
  width: $s-36;
  height: $s-36;
  cursor: pointer;
  background-color: var(--color-foreground-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;

  &:hover {
    border: $s-2 solid var(--color-accent-tertiary);
  }
}

.move-left {
  left: 0;
  margin-left: $s-44;
  transform: rotate(180deg);
}

.move-right {
  right: 0;
  margin-right: $s-44;
}

.content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax($s-276, $s-276));
  grid-auto-flow: column;
  pointer-events: all;
  height: $s-228;
  margin-left: $s-6;
  border-top-left-radius: $s-8;
  background-color: var(--color-background-quaternary);
  overflow: scroll hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scroll-snap-stop: always;
}

.card-container {
  width: $s-276;
  margin-top: $s-20;
  text-align: center;
  vertical-align: top;
  background-color: transparent;
  border: none;
  padding: 0;
  scroll-snap-align: start;
}

.template-card {
  display: inline-block;
  width: $s-256;
  font-size: $fs-16;
  cursor: pointer;
  color: var(--color-foreground-primary);
  padding: $s-3 $s-6 $s-16 $s-6;
  border-radius: $br-8;

  &:hover {
    background-color: var(--color-background-tertiary);
  }
}

.img-container {
  width: 100%;
  height: $s-136;
  margin-bottom: $s-16;
  border-radius: $br-5;
  display: flex;
  justify-content: center;
  flex-direction: column;

  img {
    border-radius: $br-4;
  }
}

.card-name {
  padding: 0 $s-6;
  display: flex;
  justify-content: space-between;
  height: $s-24;
  align-items: center;
}

.card-text {
  font-weight: $fw500;
  font-size: $fs-16;
}

.download-icon {
  @extend .button-icon;
  stroke: var(--icon-foreground);
}

.template-link {
  border: $s-2 solid transparent;
  margin: $s-32;
  padding: $s-32 0;
}

.template-link-title {
  font-size: $fs-14;
  color: var(--color-foreground-primary);
  font-weight: $fw400;
}

.template-link-text {
  font-size: $fs-12;
  margin-top: $s-8;
  color: var(--color-foreground-secondary);
}
